<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <#include "/include/base/header.ftl">
</head>
<body>
<div class="wrapper">
    <div class="main-content">
        <div class="box box-main">
            <form id="inputForm" action="${ctx}/sysDept/save" class="form-horizontal">
                <input type="hidden" name="id" value="${goodsType.id!}">
                <div class="box-body">
                    <div class="form-unit">基本信息</div>
                    <div class="row">
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="control-label col-sm-4" title="">
                                    <span class="required ">*</span> 上级分类：
                                </label>
                                <div class="col-sm-8 icheck">
                                    <#if goodsType.pid??>
                                        <input type="hidden" name="pid" value="${goodsType.pid}"/>
                                        <input type="hidden" name="path" value="${goodsType.path}"/>
                                        <input readonly="readonly" type="text" name="parentGoodsTypeName" value="${parentGoodsTypeName}" class="form-control required selectGoodsType" autocomplete="off"/>
                                    <#else>
                                        <input type="hidden" name="pid" value=""/>
                                        <input type="hidden" name="path" value=""/>
                                        <input readonly="readonly" type="text" name="parentGoodsTypeName" value="" class="form-control required selectGoodsType" autocomplete="off"/>
                                    </#if>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-6">
                            <div class="form-group">
                                <label class="control-label col-sm-4" title="">
                                    <span class="required ">*</span> 分类名称：
                                </label>
                                <div class="col-sm-8">
                                    <input type="text" name="name" value="${goodsType.name!}" minlength="2" maxlength="40" class="form-control required" autocomplete="off"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<#include "/include/base/footer.ftl">
<#include "/include/base/form.ftl">
<script>
    //选择分类
    $(".selectGoodsType").click(function () {
        layer.open({
            type: 2,
            title: "选择分类",
            shadeClose: false,
            offset: '40px',
            shade: 0.1,
            area: ['300px', '400px'],
            content: "${ctx}/common/ztreeSelect?url=/mall/goodsType/ztreeSelectData",
        });
    })

    //选择回调
    function ztreeSelectCallBack(treeNode) {
        $("input[name='pid']").val(treeNode.id);
        $("input[name='path']").val(treeNode.id+","+treeNode.pIds);
        $("input[name='parentGoodsTypeName']").val(treeNode.name);
    }
</script>
</html>